home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Tools for Macintosh
/
Power Tools for Macintosh (SoftBit)(1992).iso
/
Applications
/
Alpha 4.01
/
ACMDS
/
Delay.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-15
|
3KB
|
104 lines
/****************************************************************
* *
* Delay - pause for a second *
* *
* Copyright © 1990 Karl J. Smith. All Rights Reserved *
* *
* email: ksmith@jarthur.claremont.edu *
* *
* 8/15/90 *
* *
* When debugging, set the project type to application, *
* and add the ANSI project. *
* *
* When all your bugs are out, 'undef' DEBUG, set the project *
* type to Code Resource, with type = ACMD, name = <the name *
* of the function>, file type to 'AEXT', and the purgeable *
* flag set to true. *
* *
* Also, you need to remove the ANSI project from the ACMD *
* project and replace it with the ANSI-A4 project if you use *
* any functions in ANSI, such as strlen. *
* *
* If you are not using THINK C, I'm not quite sure what you *
* should do. :-) *
* *
****************************************************************/
#undef DEBUG
#include <stdio.h>
#include <string.h>
/* Prototypes */
char *
#ifdef DEBUG
dummy(char *inStr);
#else DEBUG
main(char *inStr);
#endif DEBUG
char *
#ifdef DEBUG
dummy(inStr)
#else DEBUG
main(inStr)
#endif DEBUG
char *inStr;
{
#define NUM_TICKS 60L /* Number of ticks to delay */
long int finalTicks; /* Total ticks since boot */
Delay(NUM_TICKS, &finalTicks);
return(inStr);
}
#ifdef DEBUG
char * ConvertRtoN(char *theStr);
char * ConvertRtoN(theStr)
char *theStr;
{
char *currentChar;
for (currentChar = theStr;*currentChar != 0; currentChar++)
if (*currentChar == '\r')
*currentChar = '\n';
}
main()
{
char *str = "Boing\rMonkey\r\n\t\v\b\f\a\\\'\"";
char *ret;
char *once;
char *currentChar;
once = NewPtr(256L);
strcpy(once, str);
ret = dummy(once);
ConvertRtoN(ret); /* Convert '\r' to '\n' so we can see them in a printf */
ConvertRtoN(str);
printf("The original is:\n\n%s", str);
printf("\n----\n\nThe result is:\n\n");
for(currentChar = ret;*currentChar != 0;currentChar++)
{
printf("%c", *currentChar);
}
}
#endif DEBUG